<%@page pageEncoding="UTF-8" isELIgnored="false" session="false"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@taglib prefix="f" uri="http://www.slim3.org/functions"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Simple Task Share - Edit Task</title>
</head>
<body>
<h3><fmt:message key="task.edit.title" /></h3>
<form action="${f:url('registtask')}" method="post">
<c:if test="${not empty key}">
<input type="hidden" ${f:hidden("key")}/></c:if>
<fmt:message key="task.edit.property.title"/> <input type="text" ${f:text("title")} class="${f:errorClass('title', 'err')}"/>${f:h(errors.title)}<br />
<fmt:message key="task.edit.date"/> <input type="text" ${f:text("date")} class="${f:errorClass('date', 'err')}"/>${f:h(errors.date)}<br />
<fmt:message key="task.edit.property.status"/> <select name="status">
<option ${f:select("status", "1")}><fmt:message key="task.status.1" /></option>
<option ${f:select("status", "10")}><fmt:message key="task.status.10" /></option>
<option ${f:select("status", "90")}><fmt:message key="task.status.90" /></option>
<option ${f:select("status", "100")}><fmt:message key="task.status.100" /></option>
</select><br />
<c:set var="deleteUrl" value="deletetask/${f:h(key)}/${version}"/>
<input type="submit" value="<fmt:message key="task.edit.submit" />" /><c:if test="${not empty key}">
<input type="button" value="<fmt:message key="task.edit.delete" />" onclick="location.href='${f:url(deleteUrl)}'"/></c:if>
<input type="button" value="<fmt:message key="task.edit.cancel"/>" onclick="location.href='${f:url('index')}'" />
</form>
<c:if test="${not empty key}">
<hr />
<h4><fmt:message key="task.edit.comment.title" /></h4>
<c:forEach var="comment" items="${task.commentList}">
<fmt:timeZone value="Asia/Tokyo" >
<fmt:formatDate value="${comment.date}" pattern="yyyy/MM/dd HH:mm:ss" /> - <c:choose><c:when test="${not empty comment.user.nickname}">${f:h(comment.user.nickname)}</c:when><c:otherwise>${f:h(comment.user.email)}</c:otherwise></c:choose><br />${f:h(comment.content)}<br /><br />
</fmt:timeZone>
</c:forEach>
<form action="${f:url('addcomment')}" method="post">
<input type="hidden" ${f:hidden("key")}/>
<textarea name="content" rows="5" style="width:100%;">
</textarea>
<input type="submit" value="<fmt:message key="task.edit.submit" />" />
</form>
</c:if>
</body>
</html>
